from django.conf.urls import url

from . import views

urlpatterns = [
    # 1.注册页面
    url(r'^register/$', views.RegisterView.as_view(),name="register"),

    # 2.判断用户名是否重复 usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view(),name="usernamecount"),

    # 3.判断手机号是否重复 mobiles/(?P<mobile>1[3-9]\d{9})/count/
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view(),name="mobilecount"),

    # 4.登录功能
    url(r'^login/$', views.LoginView.as_view(),name="login"),

    # 5.退出功能 logout/
    url(r'^logout/$', views.LogoutView.as_view(), name="logout"),

    # 6.个人中心 info/
    url(r'^info/$', views.UserInfoView.as_view(), name="info"),

    # 7.添加邮箱 emails/
    url(r'^emails/$', views.EmailView.as_view(), name='emails'),

    # 8.激活邮箱 emails/verification/
    url(r'^emails/verification/$', views.VerifyEmailView.as_view(), name='verify_emails'),

    # 9.收货地址 address/
    url(r'^address/$', views.AddressView.as_view(), name='address'),

    # 9.1. 省市区
    url(r'^areas/$', views.AreasView.as_view(), name="area"),

    # 10. 新增地址 addresses/create/
    url(r'^addresses/create/$', views.CreateAddressView.as_view(), name="creat_address"),
    #
    # # 11. 修改和删除  addresses/(?P<address_id>\d+)/
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyAddressView.as_view(), name="update_address"),
    #
    # # 12. 设置默认地址
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view(), name="default_address"),
    #
    # # 13. 设置标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.TitleAddressView.as_view(), name="title_address"),
    #
    # # 14. 显示修改密码页面 password/
    url(r'^password/$', views.ChangePwdView.as_view(), name="password"),

    # 15. 浏览记录 browse_histories/
    url(r'^browse_histories/$', views.UserBrowseHistory.as_view(), name="browse"),
]